package com.cskaoyan.shopping.controller;

import com.cskaoyan.mall.commons.result.ResponseData;
import com.cskaoyan.mall.commons.result.ResponseUtil;
import com.cskaoyan.shopping.service.IHomeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * this controller include three handlers as follows:
 *
 * /shopping/homepage
 * /shopping/navigation
 * /shopping/categories
 *
 * @author raccoon@littleraccoon.xyz
 * @since 2022/12/02 22:50
 */
@Slf4j
@RestController
@RequestMapping("shopping")
public class HomeController {
    @Autowired
    IHomeService iHomeService;

    @GetMapping("homepage")
    public ResponseData homepage() {
        return new ResponseUtil<>().setData(iHomeService.homepage());
    }

    @GetMapping("navigation")
    public ResponseData navigation() {
        return new ResponseUtil<>().setData(iHomeService.navigation());
    }

    @GetMapping("categories")
    public ResponseData categories() {
        return new ResponseUtil<>().setData(iHomeService.categories());
    }
}
